package map;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class MapTest3 {
    public static void main(String[] args) {
        Map<String, Double> map = new HashMap<>();
        map.put("牛魔王", 175.4);
        map.put("至尊宝", 182.5);
        map.put("紫霞", 168.7);
        map.put("蜘蛛精", 165.4);
        System.out.println(map);

        // 1 获取全部的键
        Set<String> keys = map.keySet();
        System.out.println(keys);
        // 2 遍历全部键，获取对应值
        for (String key : keys) {
            double value = map.get(key);
            System.out.println(key + "->" + value);
        }
    }
}